import { setKey } from '../utils/helper'

export default {
	updateNewsChannel (state, { list }) {
		state.channelList = list
		setKey('channelList', JSON.stringify(list))
	},
	updateHomepage (state, homepage) {
		state.homepage = homepage
		setKey('homepage', JSON.stringify(homepage))
	},
	updateSearchResult (state, { list }) {
		state.searchResult = list

		setKey('searchResult', JSON.stringify(list))
	},
	updateHomeIndex (state, index) {
		state.homeIndex = index

		setKey('homeIndex', index)
	},
	initHomepageList (state, homepage) {
		state.homepage = homepage
	},
}
